﻿using FluentValidation.Attributes;
using Logistics.Web.Validators;
using Nop.Services.Logistics;
using Nop.Web.Framework;
using System.Collections.Generic;
using System.Web.Mvc;

namespace Logistics.Web.Models.Order
{
    public class AvailableMeasure : SelectListItem
    {
        public decimal ConversionRatio { get; set; }
    }

    [Validator(typeof(OrderPackageValidator))]
    public class OrderPackageModel
    {
        public OrderPackageModel()
        {
            AvaliableDimensionMeasure = new List<AvailableMeasure>();
            AvaliableWeightMeasure = new List<AvailableMeasure>();
        }

        public int PackageId { get; set; }

        public int? PackagePreset { get; set; }
        //public bool IsLettersize { get; set; }

        [NopResourceDisplayName("Logistics.Order.Length")]
        public decimal? Length { get; set; }

        [NopResourceDisplayName("Logistics.Order.Width")]
        public decimal? Width { get; set; }

        [NopResourceDisplayName("Logistics.Order.Height")]
        public decimal? Height { get; set; }
        public int DimensionMeasureId { get; set; }
        public IList<AvailableMeasure> AvaliableDimensionMeasure { get; set; }

        [NopResourceDisplayName("Logistics.Order.Weight")]
        public decimal? Weight { get; set; }
        public int WeightMeasureId { get; set; }
        public IList<AvailableMeasure> AvaliableWeightMeasure { get; set; }

        public bool IsFragile { get; set; }
        public decimal FragileCharge { get; set; }

        public bool IsDangerous { get; set; }
        public decimal DangerousGoodsCharge { get; set; }

        public bool IsVertical { get; set; }
        public decimal VerticalHandlingCharge { get; set; }

        public bool IsNoLabel { get; set; }
        public decimal NoLabelCharge { get; set; }

        [NopResourceDisplayName("Logistics.Order.InsuranceValue")]
        public decimal? InsuranceValue { get; set; }
        public bool InsuranceEnabled { get; set; }

        public bool ShowNextPackage { get; set; }
        public bool ShowPreviousPackage { get; set; }
        public bool CanAddAnotherPackage { get; set; }

        public decimal MaxDimensionSize { get; set; }
        public decimal MaxSingleDimensionSize { get; set; }
        public decimal MaxWeight { get; set; }

        [NopResourceDisplayName("Logistics.Order.Comment")]
        [AllowHtml]
        public string Comment { get; set; }
        public int MaxCommentLength { get; set; }

        public ChargeRule ChargeRule { get; set; }

        public int CurrentOversizeCount { get; set; }
        public int PackageCount { get; set; }
        public decimal CurrentTotalWeight { get; set; }
        public decimal CurrentTotalAddtionalCharge { get; set; }

        public decimal Cost { get; set; }

        public int OrderKindId { get; set; }
    }
}   